import 'package:boss/ui/page/commodity/categories/page/plusCommodityMode/modal/speechRecognitionCommodity/speech_recognition_commodity_modal.dart';
import 'package:boss/ui/page/commodity/categories/page/plusCommodityMode/model/plus_commodity_mode.dart';
import 'package:boss/ui/page/commodity/categories/page/plusCommodityMode/page/plusCommodityByFormField/plus_commodity_by_form_field_page.dart';
import 'package:boss/ui/page/commodity/categories/page/plusCommodityMode/page/plusPackage/plus_package_page.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'plus_commodity_mode_item.dart';

class PlusCommodityModeList extends StatelessWidget {
  final List<PlusCommodityMode> modes = [
    PlusCommodityMode(
      title: '普通菜',
      subTitle: '固定价格菜品，如：辣子鸡¥18',
      url: PlusCommodityByFormFieldPage.pageName,
      icon: 'assets/image/knife_fork.png',
    ),
    PlusCommodityMode(
      title: '套餐',
      subTitle: '如：汉堡 + 可乐 12元',
      url: PlusPackagePage.pageName,
      icon: 'assets/image/plus_package_icon.png',
    ),
    PlusCommodityMode(
      title: '语音录菜',
      subTitle: '语音说出菜品名于价格，例：麻辣龙虾 18元',
      icon: 'assets/image/voice.png',
    ),
//    PlusCommodityMode(
//      title: '菜单识别录菜',
//      subTitle: '拍照上传或相册选择上传图片识别',
//      icon: 'assets/image/camera.png',
//    ),
  ];

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(top: ScreenUtil.instance.setWidth(29.5)),
      child: ListView.builder(
        shrinkWrap: true,
        physics: NeverScrollableScrollPhysics(),
        itemBuilder: (context, index) {
          var current = modes[index];

          return PlusCommodityModeItem(
            data: current,
            onTap: () {
              if (current.title == '语音录菜') {
                showSpeechRecognitionCommodityModal(context);
              } else {
                Navigator.pushNamed(context, current.url);
              }
            },
          );
        },
        itemCount: modes.length,
      ),
    );
  }
}
